import time

from selenium.webdriver.common.by import By
from Python_Seleinum_eladmin.utils.read_yaml import read_yaml

class LoginPage:
    def __init__(self, driver):
        self.driver = driver
        self.config = read_yaml('data/test_data.yaml')['login']

    def open_login_page(self):
        self.driver.get(self.config['url'])

    def login(self, username, password):
        self.driver.find_element(By.XPATH, self.config['username_xpath']).send_keys(username)
        self.driver.find_element(By.XPATH, self.config['password_xpath']).send_keys(password)

